/**
 *  Copyright (c)  2011-2020 Panguso, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Panguso, 
 *  Inc. ("Confidential Information"). You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into with Panguso.
 */

/*

 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.edu.thu.log.tree;

/**
 * XML每个节点存储的内容
 * 
 * @author wan
 */
public class XMLNode {
	/**
	 * 
	 */
	public static final String OPERATOR = "operator";
	/**
	 * 
	 */
	public static final String TRACE_OPERATOR = "trace operator";
	/**
	 * 
	 */
	public static final String TAGNAME = "tag name";
	/**
	 * 
	 */
	public static final String TAGFORMAT = "tag format";
	/**
	 * 
	 */
	public static final String STRINGTYPE = "string type";
	/**
	 * 
	 */
	public static final String LISTTYPE = "list type";

	private String key; // id
	private String nodename; // nodename
	private String type; // nodetype
	// private String valuetype;
	private String value = ""; // nodetype0
	private String[] valueList; // nodetype1
/**
 * 
 * @param key parameter
 * @param nodename parameter
 * @param type parameter
 */
	public XMLNode(String key, String nodename, String type) {
		this.key = key;
		this.type = type;
		this.nodename = nodename;
		if (type.startsWith("tag format")) {
			if (type.endsWith("0")) {
				this.value = nodename;
			}
			if (type.endsWith("1")) {
				if (nodename.indexOf(",") < 0) {
					valueList = new String[1];
					valueList[0] = nodename;
				} else {
					valueList = nodename.split(",");

				}
			}
		}
	}

	/**
	 * @return the key
	 */
	public String getKey() {
		return key;
	}

	/**
	 * @param key
	 *            the key to set
	 */
	public void setKey(String key) {
		this.key = key;
	}

	/**
	 * @return the nodename
	 */
	public String getNodename() {
		return nodename;
	}

	/**
	 * @param nodename
	 *            the nodename to set
	 */
	public void setNodename(String nodename) {
		this.nodename = nodename;
	}

	/**
	 * @return the type
	 */
	public String getType() {
		return type;
	}

	/**
	 * @param type
	 *            the type to set
	 */
	public void setType(String type) {
		this.type = type;
	}

	/**
	 * @return the value
	 */
	public String getValue() {
		return value;
	}

	/**
	 * @param value
	 *            the value to set
	 */
	public void setValue(String value) {
		this.value = value;
	}

	/**
	 * @return the valueList
	 */
	public String[] getValueList() {
		// for(int i=0;i<valueList.length;i++){
		// System.out.println("valueList in XMLNode:"+valueList[i]);
		// }
		return valueList;
	}

	/**
	 * @param valueList
	 *            the valueList to set
	 */
	public void setValueList(String[] valueList) {
		this.valueList = valueList;
	}
}
